home *** CD-ROM | disk | FTP | other *** search
/ Canadian Geographic Explorer / Canadian Geographic Explorer.iso / pc / riddler.dxr / 00042_Winner is script.ls < prev    next >
Encoding:
Text File  |  1996-10-03  |  3.5 KB  |  116 lines

  1. on exitFrame
  2.   global gNumPlayers, gNullCast, gVoiceChannel, gPathToSound, fileDelimiter, gSoundFXChannel
  3.   set jScore1 to integer(the text of field "player1 score")
  4.   set jScore2 to integer(the text of field "player2 score")
  5.   set jScore3 to integer(the text of field "player3 score")
  6.   set jWinner to 0
  7.   case gNumPlayers of
  8.     2:
  9.       if jScore1 > jScore2 then
  10.         set jWinner to 1
  11.       else
  12.         if jScore1 < jScore2 then
  13.           set jWinner to 2
  14.         end if
  15.       end if
  16.     3:
  17.       if jScore1 > jScore2 then
  18.         if jScore1 > jScore3 then
  19.           set jWinner to 1
  20.         else
  21.           if jScore3 > jScore1 then
  22.             set jWinner to 3
  23.           end if
  24.         end if
  25.       else
  26.         if jScore2 > jScore1 then
  27.           if jScore2 > jScore3 then
  28.             set jWinner to 2
  29.           else
  30.             if jScore3 > jScore2 then
  31.               set jWinner to 3
  32.             end if
  33.           end if
  34.         else
  35.           if (jScore3 > jScore2) and (jScore3 > jScore1) then
  36.             set jWinner to 3
  37.           end if
  38.         end if
  39.       end if
  40.   end case
  41.   if not (the puppet of sprite 3) then
  42.     puppetSprite(3, 1)
  43.   end if
  44.   if not (the puppet of sprite 4) then
  45.     puppetSprite(4, 1)
  46.   end if
  47.   if gNumPlayers = 1 then
  48.     set the memberNum of sprite 3 to the number of member "Game Over text"
  49.     set the memberNum of sprite 4 to gNullCast
  50.   else
  51.     if jWinner = 0 then
  52.       set the memberNum of sprite 3 to the number of member "Tie Game text"
  53.       set the memberNum of sprite 4 to gNullCast
  54.     else
  55.       set the memberNum of sprite 3 to the number of member "Winner is text"
  56.       set the memberNum of sprite 4 to the number of member "player name not editable"
  57.       set the text of field "player name not editable" to the text of field ("name" & jWinner)
  58.       updateStage()
  59.       sound playFile gVoiceChannel, gPathToSound & "winner" & fileDelimiter & "winris" & jWinner & ".aif"
  60.       sound playFile gSoundFXChannel, gPathToSound & "soundFX" & fileDelimiter & getAt(["liteclap", "medclap", "loudclap"], random(3)) & ".aif"
  61.     end if
  62.   end if
  63.   case gNumPlayers of
  64.     1:
  65.       if jScore1 > 1000 then
  66.         if random(2) - 1 then
  67.           set jAudioFile to "R5005.aif"
  68.         else
  69.           set jAudioFile to "R5006.aif"
  70.         end if
  71.       else
  72.         set jAudioFile to "R5004.aif"
  73.       end if
  74.     2:
  75.       if (jScore1 < 1) and (jScore2 < 1) then
  76.         set jAudioFile to "R6007.aif"
  77.       else
  78.         if jScore1 > jScore2 then
  79.           if random(2) - 1 then
  80.             set jAudioFile to "R6002_2.aif"
  81.           else
  82.             set jAudioFile to "R6003.aif"
  83.           end if
  84.         else
  85.           if jScore1 < jScore2 then
  86.             if random(2) - 1 then
  87.               set jAudioFile to "R6002.aif"
  88.             else
  89.               set jAudioFile to "R6004.aif"
  90.             end if
  91.           else
  92.             set jAudioFile to "R6001.aif"
  93.           end if
  94.         end if
  95.       end if
  96.     3:
  97.       if (jScore1 < 0) and (jScore2 < 0) and (jScore3 < 0) then
  98.         set jAudioFile to "R7001.aif"
  99.       else
  100.         if (jScore1 > 1000) and (jScore2 > 1000) and (jScore3 > 1000) then
  101.           if random(2) - 1 then
  102.             set jAudioFile to "R7004.aif"
  103.           else
  104.             set jAudioFile to "R7005.aif"
  105.           end if
  106.         else
  107.           set jAudioFile to "R6001.aif"
  108.         end if
  109.       end if
  110.   end case
  111.   repeat while soundBusy(gVoiceChannel)
  112.   end repeat
  113.   sound playFile gVoiceChannel, gPathToSound & "rules" & fileDelimiter & jAudioFile
  114.   displayScores()
  115. end
  116.